﻿using System;
using System.Reflection;
using System.Windows.Forms;

namespace Anheledir.XmlDialogEditor {
  public partial class bugreport : Form {
    public bugreport() {
      InitializeComponent();
    }

    private void button1_Click( object sender, EventArgs e ) {
      error.Visible = false;
      TicketService.projects p = Anheledir.XmlDialogEditor.TicketService.projects.XmlDialogEditor;
      string msg, sj;

      sj = "report for version " + Assembly.GetExecutingAssembly().GetName().Version.ToString();
      msg = "Version: " + Assembly.GetExecutingAssembly().GetName().Version.ToString() + Environment.NewLine + Environment.NewLine;
      msg += textBox3.Text;

      TicketService.TicketsSoapClient ts = new Anheledir.XmlDialogEditor.TicketService.TicketsSoapClient();
      if ( ts.SendTicket( textBox1.Text, textBox2.Text, p, sj, msg ) ) {
        this.Close();
      } else {
        error.Visible = true;
      }
    }

    private void bugreport_Load( object sender, EventArgs e ) {
      groupBox1.Text = languages.Information;
      groupBox2.Text = languages.PersonalData;
      richTextBox1.Text = languages.NoticeForBugreport;
      error.Text = languages.ErrorBugreport;
      label3.Text = languages.BugreportName + ":";
      label4.Text = languages.BugreportEmail + ":";
      button1.Text = languages.Send;
      this.Text = languages.BugreportHead;
    }
  }
}
